/*
 *@Author: 张楚
 *@Date: 2021-08-16 11:17:29
 *@Description: 待我查阅
*/
import 'package:flutter/material.dart';
import 'package:totaldemo/project/official_detail/wait_browse_details.dart';
import 'package:totaldemo/project/official_detail/widget/TabViewItem_Widget.dart';
import 'package:totaldemo/project/official_detail/widget/official_untils.dart';
import 'package:totaldemo/utils/util.dart';
import 'package:get/get.dart';

class WaitLookPage extends StatefulWidget {
  const WaitLookPage({Key key}) : super(key: key);
  @override
  _WaitLookPageState createState() => _WaitLookPageState();
}

class _WaitLookPageState extends State<WaitLookPage> {
  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Container(
        color: Colors.white,
        child: Column(
          children: [
            //搜素
            Container(
              margin: EdgeInsets.only(top: 10, right: 15, left: 15),
              child: OfficialUntils.seachBar(
                  title: '请输入任务名称',
                  function: () {
                    print('点击了搜索');
                    Get.to(() => WaitBrowseDetailsPage());
                  }),
            ),

            //每个item

            TabViewItemWidget(
              title: 'ddddd',
              urgencyState: '1',
              documentOffice: '国务院',
              createTime: '2020-3-35',
              channel: '1',
              isShowPublishState: false,
              publishState: 2,
            ),
            TabViewItemWidget(
              title: 'ddddd',
              urgencyState: '2',
              documentOffice: '国务院',
              createTime: '2020-3-35',
              channel: '1',
              isShowPublishState: false,
              publishState: 2,
            ),
            TabViewItemWidget(
              title: 'ddddd',
              urgencyState: '3',
              documentOffice: '国务院',
              createTime: '2020-3-35',
              channel: '1',
              isShowPublishState: false,
              publishState: 2,
            ),
          ],
        ),
      ),
    );
  }

  Widget seachBar({String title, Function function}) {
    return GestureDetector(
      behavior: HitTestBehavior.translucent,
      onTap: function,
      child: Container(
        height: 36,
        margin: EdgeInsets.only(top: 10, right: 15, left: 15),
        decoration: BoxDecoration(
            color: Color(0xffF6F6FA), borderRadius: BorderRadius.circular(18)),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Padding(
              padding: const EdgeInsets.only(left: 14),
              child: Text(
                title,
                style: TextStyle(fontSize: 14, color: Color(0xffCECECE)),
              ),
            ),
            Padding(
              padding: const EdgeInsets.only(right: 12),
              child: Icon(
                Icons.search,
                size: 16,
              ),
            )
          ],
        ),
      ),
    );
  }

  ///已经抽出为组件
  Widget WaitLookItem() {
    return Stack(
      children: [
        Container(
          margin: EdgeInsets.only(top: 15, left: 15, right: 15),
          decoration: BoxDecoration(
            borderRadius: BorderRadius.all(
              Radius.circular(1),
            ),
            color: Colors.white,
            border: Border.all(width: 0.01),
            boxShadow: [
              BoxShadow(
                color: Colors.black12.withOpacity(0.07),
                offset: Offset(0, 0), //阴影xy轴偏移量
                blurRadius: 1.5, //阴影模糊程度
                spreadRadius: 1.5, //阴影扩散程度
              ),
            ],
          ),
          child: Container(
            padding: EdgeInsets.only(top: 21, left: 16, bottom: 20),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Container(
                  width: 254,
                  child: Text(
                    '国务院关于同意建立不动产登记工作部际联席会议制度的批复',
                    style: TextStyle(fontSize: 14, color: Color(0xff3A3A3A)),
                  ),
                ),
                Padding(
                  padding: const EdgeInsets.only(top: 10, bottom: 6),
                  child: Row(
                    children: [
                      Text(
                        '特急特急',
                        style:
                            TextStyle(fontSize: 12, color: Color(0xffFF6E64)),
                      ),
                      Padding(
                        padding: const EdgeInsets.only(left: 36),
                        child: Text(
                          '省教育厅',
                          style:
                              TextStyle(fontSize: 12, color: Color(0xff666666)),
                        ),
                      )
                    ],
                  ),
                ),
                DefaultTextStyle(
                  style: TextStyle(fontSize: 12, color: Color(0xffA3A3A3)),
                  child: Row(
                    children: [
                      Text('2020-3-22'),
                      SizedBox(width: 11),
                      Text('线上')
                    ],
                  ),
                )
              ],
            ),
          ),
        ),
        //水印
        Positioned(
            right: 15,
            bottom: 0.1,
            child: Image.asset(
              Util.getUrl('official_detail_urgent.png'),
              width: 72,
              height: 72,
            ))
      ],
    );
  }
}
